package com.bigshen.demo.project.entity.lifecycle;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

@Component
public class Ship implements InitializingBean, DisposableBean {

    public Ship() {
        System.out.println("ship 构造方法初始化");
    }

    public void swim() {
        System.out.println("ship is swimming.");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("ship 行驶前加油！");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("ship 到站后熄火！");
    }

}
